using System.Data.Entity.ModelConfiguration;

namespace OBUCare.Core.Models.Mapping
{
    public class View_Parts_TransferMap : EntityTypeConfiguration<View_Parts_Transfer>
    {
        public View_Parts_TransferMap()
        {
            // Primary Key
            this.HasKey(t => new { t.ID, t.OwnerNo, t.AGENT_NO, t.PARTS_ID, t.SUPPLIER_ID, t.SUPPLIER_NAME, t.PARTS_SPEC_ID, t.SPEC_NAME, t.PARTS_COUNT, t.RECORD_DATE, t.TRANSFER_KIND, t.CREATED_BY, t.CREATED_DATE, t.STATUS });

            // Properties
            this.Property(t => t.ID);

            this.Property(t => t.OwnerNo)
                .IsRequired()
                .HasMaxLength(16);

            this.Property(t => t.Owner)
                .HasMaxLength(50);

            this.Property(t => t.OwnerTypeNo)
                .IsFixedLength()
                .HasMaxLength(2);

            this.Property(t => t.AGENT_NO)
                .IsRequired()
                .HasMaxLength(16);

            this.Property(t => t.AgentName)
                .HasMaxLength(50);

            this.Property(t => t.AgentTypeNo)
                .IsFixedLength()
                .HasMaxLength(2);

           

            this.Property(t => t.PARTS_NAME)
                .HasMaxLength(50);


            this.Property(t => t.SUPPLIER_NAME)
                .IsRequired()
                .HasMaxLength(50);

            

            this.Property(t => t.SPEC_NAME)
                .IsRequired()
                .HasMaxLength(50);

          


            this.Property(t => t.CREATED_BY)
                .IsRequired()
                .IsFixedLength()
                .HasMaxLength(6);

         

            // Table & Column Mappings
            this.ToTable("View_Parts_Transfer");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.OwnerNo).HasColumnName("OwnerNo");
            this.Property(t => t.Owner).HasColumnName("Owner");
            this.Property(t => t.OwnerTypeNo).HasColumnName("OwnerTypeNo");
            this.Property(t => t.AGENT_NO).HasColumnName("AGENT_NO");
            this.Property(t => t.AgentName).HasColumnName("AgentName");
            this.Property(t => t.AgentTypeNo).HasColumnName("AgentTypeNo");
            this.Property(t => t.PARTS_ID).HasColumnName("PARTS_ID");
            this.Property(t => t.PARTS_NAME).HasColumnName("PARTS_NAME");
            this.Property(t => t.SUPPLIER_ID).HasColumnName("SUPPLIER_ID");
            this.Property(t => t.SUPPLIER_NAME).HasColumnName("SUPPLIER_NAME");
            this.Property(t => t.PARTS_SPEC_ID).HasColumnName("PARTS_SPEC_ID");
            this.Property(t => t.SPEC_NAME).HasColumnName("SPEC_NAME");
            this.Property(t => t.PARTS_COUNT).HasColumnName("PARTS_COUNT");
            this.Property(t => t.RECORD_DATE).HasColumnName("RECORD_DATE");
            this.Property(t => t.TRANSFER_KIND).HasColumnName("TRANSFER_KIND");
            this.Property(t => t.CREATED_BY).HasColumnName("CREATED_BY");
            this.Property(t => t.OPERATOR_NAME).HasColumnName("OPERATOR_NAME");
            this.Property(t => t.CREATED_DATE).HasColumnName("CREATED_DATE");
            this.Property(t => t.STATUS).HasColumnName("STATUS");
            this.Property(t => t.Reversal_ID).HasColumnName("Reversal_ID");
        }
    }
}
